<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title></title>
    <style type="text/css">
        #box{
            height: 300px;
            background-color:#FFC0CB;
            /*弹性盒子*/
            display: flex;
            /*垂直对齐*/
            align-items: center;
            /*水平对齐*/
            justify-content: center;
        }
        #div1,#div2{
            width: 100px;
            height: 100px;
        }
        #div1{
            background-color: #6495ED;
        }
        #div2{
            background-color: #7FFFD4;
        }
    </style>
</head>
<body>
    <div id="box">
        <div id="div1">第一个div</div>
        <div id="div2">第二个div</div>
    </div>
    <!--注意，设为 Flex 布局以后，子元素的float、clear和vertical-align属性将失效 -->
</body>
</html>